package com.zhangjm.api;

import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ResultApi {

    //返回说明
    private String reason;
    //返回code码
    private Integer code;
    //返回结果
    private Object result;

    public static ResultApi success(Object result){
        return new ResultApi().setResult(result).setCode(1001).setReason("数据操作成功");
    }

    public static ResultApi error(Object result){
        return new ResultApi().setResult(result).setCode(1002).setReason("数据操作失败");
    }
}
